#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

#define in read<int>()
#define lin read<ll>()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back
#define vec vector<int>

template<typename T>
T read(){T x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);return x*sgn;}

const int N = 1e5+10;
const ll inf = 0x3f3f3f3f3f3f3f3f;

int a[N],b[N],n;
ll k,s;

ll f(int x,ll y){if(x == y) return inf;return x - 3 * y * (y - 1) - 1;}

int cal(int p,ll lim){
	int l = 1,r = a[p] - 1,ans = a[p];
	while(l <= r){
		ll mid = l + r >> 1;
		if(f(a[p],mid) > lim) l = mid + 1;
		else r = mid - 1,ans = mid;
	}return ans;
}

bool check(ll mid){
	s = 0; for(int i = 1;i <= n;i++) {int p = cal(i,mid); b[i] = p; s += p;}
	return s < k;
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; k = lin; for(int i = 1;i <= n;i++) a[i] = in;
	ll l = inf,r = 0; for(int i = 1;i <= n;i++) l = min(l,f(a[i],a[i]-1)),r = max(r,f(a[i],0));
	ll ans = r;
	while(l <= r){
		ll mid = l + r >> 1;
		if(check(mid)) r = mid - 1;
		else l = mid + 1;
	}ans = l; check(ans);
	k -= s; for(int i = 1;i <= n;i++) while(k > 0 && b[i] < a[i] && f(a[i],b[i]) == ans) b[i]++,k--;
	for(int i = 1;i <= n;i++) printf("%d%c",b[i]," \n"[i==n]);
	return 0;
}
